
	 $(function() {
		 $("form").validate({
	 		submitHandler : function(form) {//必须写在验证前面，否则无法ajax提交
	 			ly.ajaxSubmit(form,{//验证新增是否成功
	 				type : "post",
	 				dataType:"json",
	 				success : function(data) {
	 					if (data=="success") {
							my_submit();
	 						layer.confirm('更新成功!是否关闭窗口?', function(index) {
	 							parent.grid.loadData();
					        	parent.layer.close(parent.pageii);
					        	return false;
	 						});
	 					} else {
	 						layer.alert('添加失败！', 3);
	 					}
	 				}
	 			});
	 		},
	 		errorPlacement : function(error, element) {//自定义提示错误位置
	 			$(".l_err").css('display','block');
	 			//element.css('border','3px solid #FFCCCC');
	 			$(".l_err").html(error.html());
	 		},
	 		success: function(label) {//验证通过后
	 			$(".l_err").css('display','none');
	 		}
	 	});
	 });

	 function my_submit() {
		 var tableLength = $("#table_Id tr").length;//表格数量
		 for (var i = 0; i < tableLength - 1; i++) {
			 var dic = {}; //定义一个字典
			 var record = "#record" + i;
			 var myid = "#"+i;
			 var no_number = "#no_number" + i;
			 var dic = {"materialName":$("#material_code").val(),"record":$(record).val(),"no_number":$(no_number).val(),
				 "qualified":$("#qualified").val(),"inlineCheckbox1":$("#inlineCheckbox1").get(0).checked,"detection_code":$("#detection_code").val(),"myid":$(myid).html()}; //定义一个字典
			 //发送到后端
			 myAjax(dic);
		 }
	 }

	 function myAjax(data) {
		 $.ajax({
			 type: 'POST',
			 url: rootPath +'/mq/upDatafx.shtml',
			 data: data,
			 dataType:'JSON',
			 success:function(data){
			 }
		 });
	 }
